<%--
  Created by IntelliJ IDEA.
  User: 叶叶
  Date: 2022/2/18
  Time: 9:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>物料审核</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<div class="container" id="div1">
    <span style="color: blue;font-family: 华文宋体"><marquee width=400 direction=left align=middle><span>您正在做的业务是：生产管理--工序物料设计--工序物料设计单审核
</span></marquee></span>
    <!--      <div class="row" style="margin-top: 20px">-->
    <!--          <div class="col-10">-->
    <!--          </div>-->
    <!--          <div class="col-2">-->
    <!--              <button class="btn btn-primary" data-toggle="modal" data-target="#myModal" onclick="add1()">添加</button>-->
    <!--          </div>-->
    <!--      </div>-->
    <div class="container">
        <div class="row">
            <caption>
                <div style="float: right;margin-bottom: 5px">
                </div>
            </caption>
            <table id="table" class="table table-hover table-bordered" style="width: 1100px">
                <thead>
                <tr align="center">
                    <th>工序设计单编号</th>
                    <th>产品编号</th>
                    <th>产品名称</th>
                    <th>设计人</th>
                    <th>登记时间</th>
                    <th>工时总成本</th>
                    <th>制定</th>
                </tr>
                </thead>
                <tbody>

            </table>
        </div>
    </div>
</div>
<DIV class=DIV_STYLE2 style="display: none" id="div2"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0 >
    <div style="position: relative;left: 60%">
        <input class="RADIO_STYLE1" name="tg"  type="radio" value="G002-3">未通过
        <input class="RADIO_STYLE1" name="tg"  type="radio" value="G002-2">通过
        <input  onclick="queren()" class="btn3_mouseout" type=button value=确认>
        <input  onclick="fanhui()" class="btn3_mouseout" type=button value=返回>
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width="100%">
                            <TBODY>
                            <TR>
                                <TD>
                                    <table align="center">
                                        <tr>
                                            <td><h3>工序物料设计单</h3></td>
                                        </tr>
                                    </table>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>工序单编号:</span>
                                        <span id="sjbh"></span>
                                        <span style="position: absolute;left:800px;">设计人:<span id="sjr"></span></span>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>产品名称:<span id="cpmc"></span></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span style="position: absolute;left: 800px">产品编号:<span id="cpbh" ></span></span>
                                    </div>
                                    <br>
                                    <TABLE id=tableOnlineEdit class=TABLE_STYLE5 borderColor=#000000  cellSpacing=0 cols=1 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1><THEAD>
                                    <TR class=TR_STYLE2 height="10" bgColor=#d2e9ff>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left>工序名称</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>工序编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>描述</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>工时数</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>工时成本小计(元)</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>物料成本小计</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6  align=left>审核</TD></TR>
                                    <%--                                    <TR class=TR_STYLE1  height=20>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT id=checkLine class=CHECKBOX_STYLE1 type=checkbox value=on name=checkbox></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT onfocus=this.blur() class=INPUT_STYLE4 name=procedure_name>fds</TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT onfocus=this.blur() class=INPUT_STYLE4 name=procedure_ID>fds</TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><SPAN style="WIDTH: 120px; BACKGROUND: #ffffff" name="product_describe_ok"></SPAN><INPUT onfocus=this.blur() class=INPUT_STYLE4 type=hidden name=procedure_describe></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=labour_hour_amount></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=amount_unit></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=cost_price></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left>&nbsp;</TD></TR>
                                                --%>
                                    </THEAD>
                                    </TABLE>
                                    <br>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span>工时总成本:<span id="zcb"></span></span>
                                    <span style="margin-left: 500px">物料总成本:<span id="wcb"></span></span>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>审核人:<span id="djr"></span></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                                        <span style="position: relative;left:200px;">审核时间:<span id="shijian"></span></span>
                                    </div>
                                    <br>

                                    <div>
                                        <div>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span style="position: relative;top: -40px">审核意见:</span><textarea style="resize: none" rows=4 cols="100" id="sjyq"></textarea>
                                        </div>
                                    </div>
                                </TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>
<script>
    $(function () {
        $("#table").bootstrapTable({
            method:"post",
            contentType:"application/json",
            url:"/cha/wlsh",
            //初始页数
            pageNumber:1,
            pagination: true,
            sidePagination:"server",
            pageSize:2,
            pageList:[2,4,6,8,10],
            queryParams:function (param) {
                return {
                    page: (param.offset / param.limit) + 1,
                    pageNum: param.limit,
                }
            },
            columns:[
                {title:"工序设计单编号",field:"designId",align:"center"},
                {title:"产品编号",field:"productId",align:"center"},
                {title:"产品名称",field:"productName",align:"center"},
                {title:"设计人",field:"designer",align:"center"},
                {title:"登记时间",field:"registerTime",align:"center"},
                {title:"工时总成本",field:"costPriceSum",align:"center"},
                {title:"制定",field:"",align:"center", formatter:function (value, row, index) {
                        var btn2 = "<button class='btn btn-info'  onclick='shenhe(" + row.productId + ")'>审核</button>";
                        return btn2;
                    }}
            ]
        })
        $("#fh").click(function () {
            $("#table").bootstrapTable("refresh");
        })
    })
    function shenhe(productId) {
            document.getElementById("div1").style.display='none'
        document.getElementById("div2").style.display='block'
        var myDate = new Date();
        year = myDate.getYear()+1900;
        month = myDate.getMonth()+1;
        date = myDate.getDate();
        hour = myDate.getHours();
        minute =myDate.getMinutes();
        second = myDate.getSeconds();
        $.ajax({
            type:"get",
            url:"/cha/csh/"+productId,
            dataType:"json",
            success:function (data) {
                console.log(data)
                for (var i = 0; data.length; i++) {
                    document.getElementById("sjyq").innerText
                    document.getElementById("zcb").innerText = data[i].costPriceSum
                    document.getElementById("sjbh").innerText = data[i].designId
                    document.getElementById("cpmc").innerText = data[i].productName
                    document.getElementById("cpbh").innerText = data[i].productId
                    document.getElementById("djr").innerText = data[i].designer
                    document.getElementById("sjr").innerText = data[i].register
                    document.getElementById("shijian").innerText=year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second
                    var xx = data[i].mDesignProcedureDetailsList;
                    for (var i=0;xx.length;i++) {
                        document.getElementById("tableOnlineEdit").innerHTML +=
                            "<tr>" +
                            "<td>" + xx[i].mid + "</td>" +
                            "<td>" + xx[i].procedureName + "</td>" +
                            "<td>" + xx[i].procedureId + "</td>" +
                            "<td></td>" +
                            "<td>" + xx[i].labourHourAmount + "</td>" +
                            "<td>" + xx[i].subtotal + "</td>" +
                            "<td>" + xx[i].moduleSubtotal1 + "</td>" +
                            "<td><a onclick='' href='#'>审核</a></td>" +
                            "</tr>"

                    }
                }
            }
        })
    }
    function queren() {
        let productId = document.getElementById("cpbh").innerText;
        var aa = document.getElementsByName("tg");
        for (var i=0; i<aa.length; i++)
        {
            if(aa[i].checked) {
                var checkTag = aa[i].value;
            }
        }
        var xx ={
            productId:document.getElementById("cpbh").innerText,
            designModuleChangeTag:checkTag,
            checker:document.getElementById("sjr").innerText,
            changeTime:document.getElementById("shijian").innerText
        }
        let s = JSON.stringify(xx);
        $.ajax({
            type:"post",
            url: "/cha/swl/",
            dataType:"json",
            contentType: "application/json",
            data:s,
            success:function (data) {
                document.getElementById("div1").style.display='block'
                document.getElementById("div2").style.display='none'
                $("#table").bootstrapTable("refresh")
            },error:function (data) {
                console.log("Xxx")
            }
        })
    }
</script>
</body>
</html>
